﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Thrift.Protocol;
using Thrift.Server;
using Thrift.Transport;

namespace Thrift.IL
{
    /// <summary>
    /// 为thrift提供的插件容器
    /// </summary>
    public class ThriftHandle : IThriftHandle
    {
        /// <summary>
        /// 插件处理器的集合，每当一个插件被激活，
        /// 在拦截Hanle()之前，都会前自己的Processor
        /// 添加到MultiplexedProcessor中
        /// </summary>
        public readonly static TMultiplexedProcessor MultiplexedProcessor = new TMultiplexedProcessor();
   
        public void Handle()
        {
            //远程登陆调用
            new Thread(() =>
            {
                var serverTransport = new TServerSocket(9800);
                var server1 = new TThreadedServer(MultiplexedProcessor, serverTransport);
                server1.Serve();
            }).Start();
        }
    }
}
